package cn.edu.guet.jdbc.day01;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;


public class BaseDao {
	
	private String url = "jdbc:mysql://localhost:3306/jdbc";
	private String user = "root";
	private String password = "12315";
		
	public void getConnection()throws Exception{
		
			
			try {
				//1、注册驱动
				DriverManager.registerDriver(new com.mysql.jdbc.Driver());
				System.setProperty("jdbc.drivers", "com.mysql.jdbc.Driver");
				
//				Class.forName("com.mysql.jdbc.Driver");
				//2、建立连接
				Connection con = DriverManager.getConnection(url,user,password);
				//3、创建语句
				Statement sta = con.createStatement();	
				//4、执行语句
				ResultSet rs = sta.executeQuery("");
				//5、处理结果
				
				while(rs.next()){
					rs.getObject(1);
				}
				
				
				}finally{
					
				}
			}

}
